package cn.edu.qlnu.xky.test.utils;

import java.time.LocalDate;
import java.time.ZoneId;
import java.time.temporal.ChronoUnit;
import java.util.Date;

/**
 * @author wuweihong
 * @version 1.0
 * @date 2025/6/21 18:08
 * @Description: Please write your descriptions for this class.
 **/


public class DateUtils {


    public static int getDayDifference(Date borrowDate, Date dueDate) {
        LocalDate borrowLocalDate = borrowDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
        LocalDate dueLocalDate = dueDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
        return (int) ChronoUnit.DAYS.between(borrowLocalDate, dueLocalDate);
    }

}
